﻿{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script type="text/javascript" charset="utf-8" src="{lib file="swfupload/swfupload.js"}"></script>
<script type="text/javascript" charset="utf-8" src="{lib file="swfupload/js/handlers.js"}"></script>
<link type="text/css" rel="stylesheet" href="{lib file="swfupload/css/default.css"}"/>
<style type="text/css">
#divButtonContainer1 {
float: left;
background: url(../../../../../includes/libraries/javascript/swfupload/images/btn.gif) no-repeat;
padding: 5px 0px 2px 2px;
width: 86px;
height: 28px;
}

div.upload_info{
	display:block;
	float:right;
	width:100px;
	height:20px;
	padding:5px;
	background-color:#3F6;
	display:none;
}

.sub-grid{
	width:360px;
	height:60px;
	}
</style>
<script type="text/javascript">
var GOODS_SWFU;
$(function(){
    GOODS_SWFU = new SWFUpload({
        upload_url: "index.php?app=comupload&act=order_pics_upload&belongs=1000&id={$id}&upload_type=front_pic",
        flash_url: '{lib file="swfupload/swfupload.swf"}',
        post_params: {
            "ECM_ID": "{$smarty.cookies.ECM_ID}",
			"PHPSESSID":"{$phpsision}",
            "HTTP_USER_AGENT":"{$smarty.server.HTTP_USER_AGENT}",
            'ajax': 1
        },
        file_size_limit: "5 MB",
        file_types: "*.gif;*.jpg;*.jpeg;*.png",
        custom_settings: {
            upload_target: "goods_upload_progress",
            if_multirow: 1
        },

        // Button Settings
        button_image_url: '{lib file="swfupload/images/SmallSpyGlassWithTransperancy_17x18.png"}',
        button_width: 86,
        button_height: 18,
        button_text: '<span class="button">普通上传</span>',
        button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; font-weight: bold; color: #3F3D3E; } .buttonSmall { font-size: 10pt; }',
        button_text_top_padding: 0,
        button_text_left_padding: 18,
        button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
        button_cursor: SWFUpload.CURSOR.HAND,

        // The event handler functions are defined in handlers.js
        file_queue_error_handler: fileQueueError,
        file_dialog_complete_handler: fileDialogComplete,
        upload_progress_handler: uploadProgress,
        upload_error_handler: uploadError,
        upload_success_handler: uploadSuccess,
        upload_complete_handler: uploadComplete,
        button_placeholder_id: "spanButtonPlaceholder",
        file_queued_handler : fileQueued
    });
	
	
	  GOODS_SWFU1 = new SWFUpload({
        upload_url: "index.php?app=comupload&act=order_pics_upload&belongs=1000&id={$id}&upload_type=other_pic",
        flash_url: '{lib file="swfupload/swfupload.swf"}',
        post_params: {
            "ECM_ID": "{$smarty.cookies.ECM_ID}",
			"PHPSESSID":"{$phpsision}",
            "HTTP_USER_AGENT":"{$smarty.server.HTTP_USER_AGENT}",
            'ajax': 1
        },
        file_size_limit: "5 MB",
        file_types: "*.gif;*.jpg;*.jpeg;*.png",
        custom_settings: {
            upload_target: "goods_upload_progress1",
            if_multirow: 1
        },

        // Button Settings
        button_image_url: '{lib file="swfupload/images/SmallSpyGlassWithTransperancy_17x18.png"}',
        button_width: 86,
        button_height: 18,
        button_text: '<span class="button">普通上传</span>',
        button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; font-weight: bold; color: #3F3D3E; } .buttonSmall { font-size: 10pt; }',
        button_text_top_padding: 0,
        button_text_left_padding: 18,
        button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
        button_cursor: SWFUpload.CURSOR.HAND,

        // The event handler functions are defined in handlers.js
        file_queue_error_handler: fileQueueError,
        file_dialog_complete_handler: fileDialogComplete,
        upload_progress_handler: uploadProgress,
        upload_error_handler: uploadError,
        upload_success_handler: uploadSuccess,
        upload_complete_handler: uploadComplete,
        button_placeholder_id: "spanButtonPlaceholder1",
        file_queued_handler : fileQueued
    });
});

function add_uploadedfile(file_data)
{
	if(file_data.upload_type=="front_pic")
	{
		$(".front_pic_info").show();
		$("#front_pic").val(file_data.file_path);
		
	}
	else
	{
		$(".other_pic_info").show();
		$("#other_pic").val(file_data.file_path);

	}
}

function submit_pic(){
	var id=$("#id").val();
	var front_pic=$("#front_pic").val();
	var other_pic=$("#other_pic").val();

	if(id=="0")
	{
		window.parent.update_order_pics(front_pic,other_pic);
	}
	else
	{
		window.parent.update_order_pics(front_pic,other_pic);
	}
}
</script> 
<body>
<form method="post" action="{url app=comupload&act=sample_pics}{if $smarty.get.id}&id={$smarty.get.id}{/if}" enctype="multipart/form-data">
<div class="sub-body upload_wrap" style="width:360px;">
  <h3 class="title-1">{$lang.upload_pic}</h3>
    <div>
 <span></span>
	<div id="divSwfuploadContainer">
    <div class="upload_info o_pic_info">
    <input type="hidden" name="o_pic" id="o_pic" value="" />
    <span></span></div>
	</div></div>
 <div class="sub-grid">
 <span>{$lang.front_pic}：</span>
	<div id="divSwfuploadContainer">
	<div id="divButtonContainer"><span id="spanButtonPlaceholder"></span>
	</div>
    <div id="goods_upload_progress"></div>
    <div class="upload_info front_pic_info">
        <input type="hidden" name="front_pic" id="front_pic" value="" />
    <span>{$lang.front_pic}已上传</span></div>
	</div></div>
	<p>&nbsp;</p>
    <p>&nbsp;</p>
 <div>
 <span>{$lang.other_pic}：</span>
	<div id="divSwfuploadContainer">
	<div id="divButtonContainer"><span id="spanButtonPlaceholder1"></span>
	</div>
    <div id="goods_upload_progress1"></div>
   
      <div class="upload_info other_pic_info">
      <input type="hidden" name="other_pic" id="other_pic" value="" />
      <span>{$lang.other_pic}已上传</span></div>

	</div>
 
 

 <input type="hidden" name="id" id="id" value="{$id}" />
 
 </div>

<br />
<div><!-- /* 提交按钮加入onClick="this.disabled='disabled'"，以防二次提交上传 */ -->
  <input style="margin-left: 49px;
margin-top: 30px;" type="button" class="btn-4" value="{$lang.submit}" onClick="submit_pic()" />
</div>
</div>
</form>
</body>
</html>
